<template>
  <div class="main_box" style="padding:10px">
    <div class="add_wrap">
      <el-form label-width="200px" v-if="dataInfo">
      <div class="tit">
        <h2>基础信息</h2>
        <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList">返回</el-button>
      </div>
      <el-row>
          <el-form-item label="商户名称:">
            <span>{{dataInfo.businessName}}</span>
          </el-form-item>
          <el-form-item label="商户类型:">
            <span>{{formatBusinessType(dataInfo.businessType)}}</span>
          </el-form-item>
          <el-form-item label="服务:">
            <span>{{dataInfo.serverList}}</span>
          </el-form-item>
          <el-form-item label="联系人:">
            <span>{{dataInfo.linkName}}</span>
          </el-form-item>
          <el-form-item label="联系电话:">
            <span>{{dataInfo.linkPhone}}</span>
          </el-form-item>
          <!-- <el-form-item label="省份:">
            <span>{{dataInfo.provinceName}}</span>
          </el-form-item>
          <el-form-item label="城市:">
            <span>{{dataInfo.cityName}}</span>
          </el-form-item>
          <el-form-item label="区名称:">
            <span>{{dataInfo.areaName}}</span>
          </el-form-item> -->
          <el-form-item label="联系地址:">
            <span>{{linkAddress}}</span>
          </el-form-item>
          <el-form-item label="备注:">
            <span>{{dataInfo.remark}}</span>
          </el-form-item>
          <el-form-item label="创建人:">
            <span>{{ dataInfo.createUserName}}</span>
          </el-form-item>
          <el-form-item label="创建时间:">
            <span>{{ dataInfo.createDate }}</span>
          </el-form-item>
          <el-form-item label="修改人:">
            <span>{{ dataInfo.modifyUserName}}</span>
          </el-form-item>
          <el-form-item label="修改时间:">
            <span>{{ dataInfo.modifyDate }}</span>
          </el-form-item>

      </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
import EquipApi from '@/api/equip/equip';
export default {
  data() {
    return {
      dataInfo: {},
    };
  },
  computed:{
    // 把省市区和详细地址合并起来为联系地址
    linkAddress(){
      return this.dataInfo.provinceName+this.dataInfo.cityName+this.dataInfo.areaName+this.dataInfo.address
    }
  },
  mounted(){
    this.getData()
  },
  methods: {
    getData() {
     EquipApi.getBeeperBusinessInfo({id:this.$route.query.id}).then(res=>{
        this.dataInfo = res.data
        this.dataInfo.serverList= res.data.beeperServers.map(item=>item.serverName).join("，")
      })
    },
    formatBusinessType(cellValue){
       if (cellValue == 1) {
            return '餐饮'
        } else if (cellValue == 2) {
            return '医疗'
        } else if(cellValue==3){
          return '家政'
        } else if(cellValue == 4){
          return '生活'
        } else if(cellValue==5){
          return '其他'
        }
    },
    returnList() {
      this.$store.dispatch('delView', this.$route);
      this.$router.push({ path:'/equip/businessManagement'})
    }
  },

}

</script>
<style lang="scss" src="@/assets/css/views/add.scss" scope></style>
